/* 类型推断 */
// ts可以推断出count 为number类型
let count = 123;

/* void VS never */
/* enum JiShiEnum {
    REDJ,
    BLUEJ,
    GREENJ,
}

function sayHello(): void {
    console.log("hello world");
}

// 如果一个函数是永远也执行不完的，就可以定义返回值为 never
function errorFuntion(): never {
    throw new Error();
    console.log("Hello World");
}

// 定义一个小姐姐
interface IGirl {
    name: string;
    age: number;
    skill: string;
    isAnMo: boolean;
    number: JiShiEnum;
}

// 定义搜索小姐姐的入参
interface ISearchParams extends IGirl {
    serviceTime: string;
}

interface IGetGirls {
    data: IGirl[];
}

// 函数主体
export function getGirls(data: ISearchParams): Promise<IGetGirls> {
    return axios({
        url: `/dabaojian/getGirls`,
        method: "GET",
        data,
    });
}
 */

/* 类型检测 */
/* interface Hero {
    name: string;
    skill: string;
}

const zed: Hero = { name: "影流之主", skill: "影子" };
type LOL = typeof zed; // type LOL = Hero
const ahri: LOL = { name: "阿狸", skill: "魅惑" };

class NumberObj {
    count: number;
}

function addObj(first: object | NumberObj, second: object | NumberObj) {
    if (first instanceof NumberObj && second instanceof NumberObj) {
        return first.count + second.count;
    }
    return 0;
}

// keyof 与 Object.keys 略有相似，只不过 keyof 取 interface 的键
interface Point {
    x: number;
    y: number;
}

// type keys = "x" | "y"
type keys = keyof Point;

function get<T extends object, K extends keyof T>(o: T, name: K): T[K] {
    return o[name];
}

console.log(
    get(
        {
            name: "张三",
            age: 18,
        },
        "name"
    )
);
 */

/* 访问权限关键字 */
/* 
public 公开的
private 类的外部不可用，继承也不行
protected 类的外部不可用，继承可以
public readOnly xxx 只读属性
static funcXXX 静态方法，不需要 new 就可以调用
abstract funcXXX 抽象类，所有子类都必须要实现 funcXXX
 */

